package com.sanen.flyer.entity.hero;

import com.sanen.flyer.common.Constant;
import com.sanen.flyer.entity.Bullet;
import com.sanen.flyer.entity.Jet;
import com.sanen.flyer.factory.BulletFactory;
import com.sanen.flyer.factory.JetFactory;
import com.sanen.flyer.main.Game;
import com.sanen.flyer.tool.Console;
import com.sanen.flyer.tool.ImageTool;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;

/**
 * @author wsse
 * @date 2018-09-06 19:25
 */
public class HuanYing extends Hero {
    public HuanYing(BufferedImage image) {
        this.image = image;
        this.speedx = 1.8;
        this.speedy = 2;
        this.width= (int) (image.getWidth()* Constant.getRatio());
        this.height= (int) (image.getHeight()* Constant.getRatio());
        this.windowWidth=Constant.getWindowWidth();
        this.windowHeight= Constant.getWindowHeight();
        jetL= JetFactory.getJet(JetFactory.JET_BLUE,this,(int)Constant.getRatio()*(x+width/2-7),(int)Constant.getRatio()*(y+height-20));
        jetR= JetFactory.getJet(JetFactory.JET_BLUE,this,(int)Constant.getRatio()*(x+width/2+5),(int)Constant.getRatio()*(y+height-20));
    }
    int i;
    public void draw(Graphics g) {
        super.draw(g);
        g.drawImage(image, x, y, width,height,null);

    }

    @Override
    public void logic() {
        move();
        count++;
    }
    public List<Bullet> shoot(){
        List<Bullet> list=new ArrayList<>();
        if(count%20==0)list.add(BulletFactory.getBullet(this,BulletFactory.DAO_DAN,x+width/2,y));
        return list;
    }

}
